﻿#include "editor/imview.h"
#include "ui/controls.h"

using namespace anip;

editor::ImageView::ImageView(Container* parent, const Texture2D* tex):
	EditorWindow(parent, { 500, 500 }, L"图片")
{
	auto& btn = addCloseButton();
	btn.texture = Settings::closeButtonTexture.get();

	_cv = new ui::Canvas(this);
	_cv->layoutOptions.dock = Control::LayoutOptions::DockType::Fill;
	_cv->fitType = ui::Canvas::FitType::Rescale;
	_cv->texture = tex;
	if (tex != nullptr)
	{
		setSize(tex->size() * 0.5f);
	}
}